<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="button" value="修改" @click="setM" name="" id="">
        <input type="" v-model="message" @keyup.enter="getM" name="" id="">
        <h2>{{message}}</h2>
    </div>
    <script src="http://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                message: "黑马"
            },
            methods: {
                getM: function () {
                    alert(this.message)
                },
                setM: function () {
                    this.message = "啦啦啦"
                }
            },
        })
    </script>
</body>

</html>